import { RouteRecordRaw } from 'vue-router';
import { AppRouteRecordRaw } from '../types/router';

export const LAYOUT = () => import('@/layouts/default/index.vue');

const routes: AppRouteRecordRaw[] = [
  {
    path: '/',
    name: 'Home',
    redirect: '/home/index',
    meta: {
      title: 'Home'
    }
  },
  {
    path: '/app',
    name: 'App',
    component: LAYOUT,
    redirect: '/not-found',
    meta: {
      title: 'System'
    },
    children: [
      {
        path: '/not-found',
        name: 'NotFound',
        component: () => import('@/views/app/not-found/index.vue'),
        meta: {
          title: '404'
        }
      }
    ]
  },
  {
    path: '/login',
    name: 'Login',
    component: () => import('@/views/app/login/index.vue'),
    meta: {
      title: '登录'
    }
  }
];

const constantsRoutes: AppRouteRecordRaw[] = [
  {
    path: '/:pathMactch(.*)',
    name: 'Catch',
    meta: {
      title: '404'
    },
    redirect: '/not-found'
  }
];

export const constants = routes as RouteRecordRaw[];
export const constantsBefore = constantsRoutes;
